import React, { useEffect, useState } from "react";
import { Form, Input, Button, Checkbox } from 'antd';
import store from '../store'
export default function Index2() {
    const [obj, setObj] = useState(() => store.getState())
    const { value, list, object } = obj || {}
    useEffect(() => {
        const unsubscribe = store.subscribe(() => {
            setObj(store.getState())
        })
        return () => {
            unsubscribe();
        }
    })
    return (
        <div>
            <Input value={value}></Input>
            <br />
            {object.age}
            <br />
            {list.map((item, index) => {
                return <div key={index}>
                    {item}
                </div>
            })}
        </div>
    )
}